﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SDL;

namespace BusinessLogic
{
    public partial class UserInfo
    {
        public List<EventInfo> getEvents()
        {
            var n = new EventInfo();
            n["id"] = this.Id;
            n.Run("user.getEvents");
            return new List<EventInfo>(n.getList<EventInfo>());
        }


        public List<EventInfo> getNotificationEvents()
        {
            var n = new EventInfo();
            n["id"] = this.Id;
            n.Run("user.getNotificationEvents");
            return new List<EventInfo>(n.getList<EventInfo>());
        }

        public void addEvent(Guid eventId)
        {
            var n = new UserInfo();
            n["user_id"] = this.Id;
            n["event_id"] = eventId;
            n.Run("user.addEvent");            
        }

        public void save()
        {
            this.Run("user.update", true);
        }
    }
}
